package com.kc.web.controller.business;

import com.kc.business.domain.BizUser;
import com.kc.business.service.IBizUserService;
import com.kc.common.annotation.Log;
import com.kc.common.core.controller.BaseController;
import com.kc.common.core.domain.AjaxResult;
import com.kc.common.core.page.TableDataInfo;
import com.kc.common.enums.BusinessType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName BizUserController
 * @Description 用户相关controller
 * @Author wangdongliang
 * @Date 2021/5/17 17:23
 */
@RestController
@RequestMapping("/business/userInfo")
public class BizUserController extends BaseController {
    @Resource
    private IBizUserService userService;

    /**
     * 获取注册用户列表
     * @return
     */
    @PreAuthorize("@ss.hasPermi('business:userInfo:getRegisterUserList')")
    @GetMapping("/getRegisterUserList")
    public TableDataInfo getRegisterUserList(BizUser bizUser){
        startPage();
        return getDataTable(userService.getRegisterUserList(bizUser));
    }


    @Log(title = "注册用户管理", businessType = BusinessType.UPDATE)
    @PreAuthorize("@ss.hasPermi('business:userInfo:setUserPassword')")
    @PutMapping("/setUserPassword/{userId}")
    public AjaxResult setUserPassword(@PathVariable("userId") Integer userId){
        userService.setUserPassword(userId);
        return AjaxResult.success();
    }




}
